/*题目：
 * 小明家新开了两个工厂用来生产家具，一个生产现代风格的沙发和椅子，一个生产古典风格的沙发和椅子。
 * 现在工厂收到了一笔订单，请你帮他设计一个系统，描述订单需要生产家具的信息。
 * 输入：输入的第一行是一个整数 N（1 ≤ N ≤ 100），表示订单的数量。
        接下来的 N 行，每行输入一个字符串，字符串表示家具的类型。
        家具类型分为 "modern" 和 "classical" 两种
 * 输出：对于每笔订单，输出字符串表示该订单需要生产家具的信息。
        modern订单会输出下面两行字符串
        modern chair
        modern sofa
        classical订单会输出下面两行字符串
        classical chair
        classical soft
 * 示例：
 *      输入：3
            modern
            classical
            modern
        输出：modern chair
            modern sofa
            classical chair
            classical sofa
            modern chair
            modern sofa
 * */

#include <iostream>
#include <vector>
using namespace std;
class Chair{
public:
    virtual void show()=0;
};

class ModernChair:public Chair{
public:
    void show() override{
        cout<<"Modern Chair"<<endl;
    }
};

class ClassicalChair:public Chair{
public:
    void show() override{
        cout<<"Classical Chair"<<endl;
    }
};

class Sofa{
public:
    virtual void show()=0;
};

class ModernSofa:public Sofa{
public:
    void show() override{
        cout<<"Modern Sofa"<<endl;
    }
};

class ClassicalSofa:public Sofa{
public:
    void show() override{
        cout<<"Classical Sofa"<<endl;
    }
};

//抽象工厂
class Factory{
public:
    virtual Chair* createChair()=0;
    virtual Sofa* createSofa()=0;
};

//抽象现代工厂
class ModernFactory:public Factory{
public:
    Chair* createChair() override{
        return new ModernChair();
    }
    Sofa* createSofa() override{
        return new ModernSofa();
    }
};

//抽象古典工厂
class ClassicalFactory:public Factory{
public:
    Chair* createChair() override{
        return new ClassicalChair();
    }
    Sofa* createSofa() override{
        return new ClassicalSofa();
    }

};

int main(){
    int num=0;
    cin>>num;
    for (int i = 0; i < num; ++i) {
        string type="";
        cin>>type;

        Factory* factory= nullptr;
        if (type=="modern")
            factory=new ModernFactory();
        else
            factory=new ClassicalFactory();

        Chair* chair=factory->createChair();
        Sofa* sofa=factory->createSofa();

        chair->show();
        sofa->show();

        delete chair;
        delete sofa;
        delete factory;
    }
    return 0;
}